package model;

import java.util.ArrayList;
import java.util.Date;

public class Order {
	private int orderId;
	private int clientId;
	private int invoiceId;
	private double price;
	private ArrayList<ProductLine> products;
	private Date fromDate;
	private Date toDate;
	
	
	public Order(int orderId, int clientId, int invoiceId) {
		this.orderId = orderId;
		this.clientId = clientId;
		this.invoiceId = invoiceId;
		products = new ArrayList<ProductLine>();
	}
	public Order() {
		products = new ArrayList<ProductLine>();
	}
	public void calculatePrice()
	{
		for(ProductLine productLine : products)
		{
			this.price += productLine.getSubTotalPrice();
		}
	}
	public int getInvoiceId() {
		return invoiceId;
	}
	public void setInvoiceId(int invoiceId) {
		this.invoiceId = invoiceId;
	}
	public void insertProduct(ProductLine productLine)
	{
		products.add(productLine);
	}
	
	// getters and setters//
	public int getClientId() {
		return clientId;
	}
	public void setClientId(int clientId) {
		this.clientId = clientId;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public ArrayList<ProductLine> getProducts() {
		return products;
	}
	public void setProducts(ArrayList<ProductLine> products) {
		this.products = products;
	}
	public Date getFromDate() {
		return fromDate;
	}
	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}
	public Date getToDate() {
		return toDate;
	}
	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}
	public int getOrderId() {
		return orderId;
	}

}
